Skip to content

Conversation

@abhinaykukkadapu
Copy link
Contributor

@abhinaykukkadapu abhinaykukkadapu commented Aug 29, 2025

Stack from ghstack (oldest at bottom):

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

Usage

from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe

# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp16"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")

Advanced usage to combine specific recipes of one or two or backends

one can directly use ExportRecipe.combine_recipes() to combine specific backend recipes.

recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)

Additional changes:

  1. Relaxed kwarg validation in the backend providers to just ignore them instead of erroring out.

Fixes: #13732

Differential Revision: D81297451

…dels to a target device

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export, ExportRecipe, IOSTargetRecipeType

# CoreML + XNNPACK
coreml_xnnpack_recipe = ExportRecipe.get_recipe(IOSTargetRecipeType.IOS_ARM64_COREML_FP32)
session = export(model, coreml_xnnpack_recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(AndroidRecipeType.XYZ)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```

Fixes: #13732

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Aug 29, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/13791

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures

As of commit ef5f1ad with merge base 19d22ab (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

abhinaykukkadapu added a commit that referenced this pull request Aug 29, 2025
…dels to a target device

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export, ExportRecipe, IOSTargetRecipeType

# CoreML + XNNPACK
coreml_xnnpack_recipe = ExportRecipe.get_recipe(IOSTargetRecipeType.IOS_ARM64_COREML_FP32)
session = export(model, coreml_xnnpack_recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(AndroidRecipeType.XYZ)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```

Fixes: #13732

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)

ghstack-source-id: 306434236
Pull Request resolved: #13791
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 29, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81297451

@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

…lowering models to a target device"

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export, ExportRecipe, IOSTargetRecipeType

# CoreML + XNNPACK
coreml_xnnpack_recipe = ExportRecipe.get_recipe(IOSTargetRecipeType.IOS_ARM64_COREML_FP32)
session = export(model, coreml_xnnpack_recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(AndroidRecipeType.XYZ)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```

Fixes: #13732

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)

[ghstack-poisoned]
abhinaykukkadapu added a commit that referenced this pull request Aug 29, 2025
…dels to a target device

Pull Request resolved: #13791

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export, ExportRecipe, IOSTargetRecipeType

# CoreML + XNNPACK
coreml_xnnpack_recipe = ExportRecipe.get_recipe(IOSTargetRecipeType.IOS_ARM64_COREML_FP32)
session = export(model, coreml_xnnpack_recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(AndroidRecipeType.XYZ)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```

Fixes: #13732
ghstack-source-id: 306438497
@exported-using-ghexport

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81297451

@kimishpatel
Copy link
Contributor

I left a comment on the original issue. Not fully convinced why we need multibackend recipe as a separate concept

…lowering models to a target device"

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export, ExportRecipe, IOSTargetRecipeType

# CoreML + XNNPACK
coreml_xnnpack_recipe = ExportRecipe.get_recipe(IOSTargetRecipeType.IOS_ARM64_COREML_FP32)
session = export(model, coreml_xnnpack_recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(AndroidRecipeType.XYZ)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```

Fixes: #13732

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)

[ghstack-poisoned]
abhinaykukkadapu added a commit that referenced this pull request Sep 2, 2025
…dels to a target device

Pull Request resolved: #13791

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe

# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp32"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage to combine specific recipes of two or one backend
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```

Fixes: #13732
ghstack-source-id: 307058764
@exported-using-ghexport

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81297451

…lowering models to a target device"

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export, ExportRecipe, IOSTargetRecipeType

# CoreML + XNNPACK
coreml_xnnpack_recipe = ExportRecipe.get_recipe(IOSTargetRecipeType.IOS_ARM64_COREML_FP32)
session = export(model, coreml_xnnpack_recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(AndroidRecipeType.XYZ)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```

Fixes: #13732

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)

[ghstack-poisoned]
abhinaykukkadapu added a commit that referenced this pull request Sep 3, 2025
…dels to a target device

Pull Request resolved: #13791

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe

# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp32"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage to combine specific recipes of one or two or backends
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```
Additional changes:
1. Relaxed kwarg validation in the backend providers to just ignore them instead of erroring out.

Fixes: #13732
ghstack-source-id: 307121550
@exported-using-ghexport

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81297451

@abhinaykukkadapu
Copy link
Contributor Author

I left a comment on the original issue. Not fully convinced why we need multibackend recipe as a separate concept

@kimishpatel Removed the multi backend provider and went with simple funciton calls.

…lowering models to a target device"

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export, ExportRecipe, IOSTargetRecipeType

# CoreML + XNNPACK
coreml_xnnpack_recipe = ExportRecipe.get_recipe(IOSTargetRecipeType.IOS_ARM64_COREML_FP32)
session = export(model, coreml_xnnpack_recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(AndroidRecipeType.XYZ)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```

Fixes: #13732

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)

[ghstack-poisoned]
abhinaykukkadapu added a commit that referenced this pull request Sep 3, 2025
…dels to a target device

Pull Request resolved: #13791

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe

# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp32"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage to combine specific recipes of one or two or backends
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```
Additional changes:
1. Relaxed kwarg validation in the backend providers to just ignore them instead of erroring out.

Fixes: #13732
ghstack-source-id: 307139141
@exported-using-ghexport

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81297451

if unexpected:
raise ValueError(
f"Recipe '{recipe_type.value}' received unexpected parameters: {list(unexpected)}"
logging.warning(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this turned into warning now? to combine multiple recipes? and fallback to the other backend when it fails?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, to combine multiple recipes, for example, get_coreml_recipe(**kwargs) this will have to forward them to both coreml and xnnpack. Hard failure like above would restrict the creation of multi backend recipes.

Copy link
Contributor

@kimishpatel kimishpatel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks ok to me. some nits plus a comment on quantizaiton.

you probably want to add recipes plus test for android

@abhinaykukkadapu
Copy link
Contributor Author

looks ok to me. some nits plus a comment on quantizaiton.

you probably want to add recipes plus test for android

Thanks for the review, will add android specific things after adding QNN recipes, which i'm working on right now.

…lowering models to a target device"

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export, ExportRecipe, IOSTargetRecipeType

# CoreML + XNNPACK
coreml_xnnpack_recipe = ExportRecipe.get_recipe(IOSTargetRecipeType.IOS_ARM64_COREML_FP32)
session = export(model, coreml_xnnpack_recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(AndroidRecipeType.XYZ)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```

Fixes: #13732

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)

[ghstack-poisoned]
abhinaykukkadapu added a commit that referenced this pull request Sep 3, 2025
…dels to a target device

Pull Request resolved: #13791

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe

# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp32"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage to combine specific recipes of one or two or backends
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```
Additional changes:
1. Relaxed kwarg validation in the backend providers to just ignore them instead of erroring out.

Fixes: #13732
ghstack-source-id: 307321089
@exported-using-ghexport

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81297451

…lowering models to a target device"


This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe

# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp16"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage to combine specific recipes of one or two or backends
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```
Additional changes:
1. Relaxed kwarg validation in the backend providers to just ignore them instead of erroring out.

Fixes: #13732

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)

[ghstack-poisoned]
abhinaykukkadapu added a commit that referenced this pull request Sep 3, 2025
…dels to a target device

Pull Request resolved: #13791

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe

# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp16"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage to combine specific recipes of one or two or backends
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```
Additional changes:
1. Relaxed kwarg validation in the backend providers to just ignore them instead of erroring out.

Fixes: #13732
ghstack-source-id: 307327146
@exported-using-ghexport

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81297451

…lowering models to a target device"


This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe

# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp16"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage to combine specific recipes of one or two or backends
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```
Additional changes:
1. Relaxed kwarg validation in the backend providers to just ignore them instead of erroring out.

Fixes: #13732

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)

[ghstack-poisoned]
abhinaykukkadapu added a commit that referenced this pull request Sep 3, 2025
…dels to a target device

Pull Request resolved: #13791

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe

# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp16"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage to combine specific recipes of one or two or backends
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```
Additional changes:
1. Relaxed kwarg validation in the backend providers to just ignore them instead of erroring out.

Fixes: #13732
ghstack-source-id: 307388517
@exported-using-ghexport

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81297451

…lowering models to a target device"


This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe

# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp16"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage to combine specific recipes of one or two or backends
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```
Additional changes:
1. Relaxed kwarg validation in the backend providers to just ignore them instead of erroring out.

Fixes: #13732

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)

[ghstack-poisoned]
abhinaykukkadapu added a commit that referenced this pull request Sep 4, 2025
…dels to a target device

Pull Request resolved: #13791

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe

# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp16"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage to combine specific recipes of one or two or backends
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```
Additional changes:
1. Relaxed kwarg validation in the backend providers to just ignore them instead of erroring out.

Fixes: #13732
ghstack-source-id: 307424597
@exported-using-ghexport

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81297451

…lowering models to a target device"


This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe

# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp16"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage to combine specific recipes of one or two or backends
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```
Additional changes:
1. Relaxed kwarg validation in the backend providers to just ignore them instead of erroring out.

Fixes: #13732

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)

[ghstack-poisoned]
abhinaykukkadapu added a commit that referenced this pull request Sep 4, 2025
…dels to a target device

Pull Request resolved: #13791

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe

# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp16"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage to combine specific recipes of one or two or backends
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```
Additional changes:
1. Relaxed kwarg validation in the backend providers to just ignore them instead of erroring out.

Fixes: #13732
ghstack-source-id: 307671542
@exported-using-ghexport

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81297451

@abhinaykukkadapu abhinaykukkadapu merged commit e4bf93e into gh/abhinaykukkadapu/8/base Sep 5, 2025
121 of 125 checks passed
@abhinaykukkadapu abhinaykukkadapu deleted the gh/abhinaykukkadapu/8/head branch September 5, 2025 01:25
abhinaykukkadapu added a commit that referenced this pull request Sep 5, 2025
…dels to a target device

Pull Request resolved: #13791

This diff introduces multi backend/ target based recipes to lower a model with very less code. Target recipes provide pre-configured backend recipes to use them and retarget if needed.

See RFC: #13732

## Usage

```
from executorch.export import export
from executorch.export.target_recipes import get_ios_recipe

# CoreML + XNNPACK (FP32)
recipe = get_ios_recipe() # default = "ios-arm64-coreml-fp16"
session = export(model, recipe, example_inputs)
session.save_pte_file("model.pte")
```

## Advanced usage to combine specific recipes of one or two or backends
one can directly use `ExportRecipe.combine_recipes()` to combine specific backend recipes.
```
recipe1 = ExportRecipe.get_recipe(CoreMLRecipeType.FP32)
recipe2 = ExportRecipe.get_recipe(XNNPackRecipeType.FP32)
combined_recipe = ExportRecipe.combine(
                     [recipe1, recipe2],
                     recipe_name="multi_backend_coreml_xnnpack_fp32"
                  )
session = export(model, combined_recipe, example_inputs)
```
Additional changes:
1. Relaxed kwarg validation in the backend providers to just ignore them instead of erroring out.

Fixes: #13732
ghstack-source-id: 307671542
@exported-using-ghexport

Differential Revision: [D81297451](https://our.internmc.facebook.com/intern/diff/D81297451/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants